package com.kuang.design.creation.sigle;

/**
 * 单例模式
 */
public class MainTest {
    public static void main(String[] args) {
        System.out.println("0");
        Person kuang = Person.kuang();
        System.out.println("0");
        Person kuang1 = Person.kuang();
        System.out.println("1");
        Person hu = Person.hu();
        System.out.println("2");
        Person lazyOne = Person.lazyOne();
        System.out.println("kuang==kuang1:" + (kuang == kuang1 ? "1" : "0"));//1
        System.out.println("kuang==hu:" + (kuang == hu ? "1" : "0"));//1

        System.out.println("kuang==lazyOne:" + (kuang == lazyOne ? "1" : "0"));//0
    }
}
